/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2025/4/24
 * Time: 22:56
 */

#include "Actor.h"
#include "../raw/Stats.h"
#include "Scene.h"

#include <glm/common.hpp>
void Actor::Move(float _dt)
{
    SetPosition(position_ + velocity_ * _dt);
    // SDL_Log("dt: %f, position: (%f, %f), velocity: (%f, %f)", _dt, position_.x, position_.y, velocity_.x, velocity_.y);
    position_ = glm::clamp(position_, glm::vec2(0), game_.GetCurrentScene()->GetWorldSize());
    // }
}

void Actor::TakeDamage(float _damage)
{
    if(nullptr == stats_)
        return;
    stats_->TakeDamage(_damage);
}

bool Actor::IsAlive() const
{
    if(nullptr == stats_)
        return true;
    return stats_->IsAlive();
}